package com.mingle.sample;

import com.mingle.widget.ShapeLoadingDialog;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;

/**
 * 示例演示页面
 */
public class MainAbility extends Ability {

    private ShapeLoadingDialog shapeLoadingDialog;

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        setUIContent(ResourceTable.Layout_ability_main);
        shapeLoadingDialog = new ShapeLoadingDialog.Builder(this)
                .loadText("加载中...") // 设置文本
                .cancelable(false) // 当用户点击返回键时是否消失Dialog
                .canceledOnTouchOutside(true) // 当用户点击Dialog外部时是否消失Dialog
                .build();
        findComponentById(ResourceTable.Id_btn_dialog).setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                shapeLoadingDialog.show(); // 显示Dialog
            }
        });
    }

}
